<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title></title>
  <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
  <div id='app'>
    <div> {{ msgFa }} ============ {{msgSon}}</div>
    <div>
      <son @send="getSon"></son> 
    </div>
  </div>
  <script type='text/javascript'>
    Vue.component('son', {
      data() {
        return {
          msgSon: '这是子元素的数据'
        }
      },
      template: `
        <div @click="send">{{ msgSon }}</div>
      `,
      methods: {
        send() {
          this.$emit('send', this.msgSon)
        }
      },

    })
    var vm = new Vue({
      el: '#app',
      data: {
        msgFa: '这是父元素的数据',
        msgSon: ''
      },
      methods: {
        getSon(val){
          this.msgSon = val;
          console.log(val);
        }
      }
    });
  </script>
</body>

</html>